package com.kstech.mp3604.fragments

import com.kstech.mp3604.base.BaseDialogFragment
import com.kstech.mp3604.databinding.FragmentDialogTestUiBinding
import com.kstech.mp3604.ui.listener.TestUiListener

/**
 *  设置按钮 测试UI 后转移接口 会取消
 */
class DialogTestUiFragment(val listener: TestUiListener) :
    BaseDialogFragment<FragmentDialogTestUiBinding>(FragmentDialogTestUiBinding::inflate) {
    override fun onInitView() {
        binding.apply {
            switch1.setOnCheckedChangeListener { buttonView, isChecked ->
                if (isChecked) {
                    listener.showYJ()
                } else {
                    listener.closeYJ()
                }
            }
            switch2.setOnCheckedChangeListener { buttonView, isChecked ->
                if (isChecked) {
                    listener.showZDHZ()
                } else {
                    listener.closeZDHZ()
                }
            }

            switch3.setOnCheckedChangeListener { buttonView, isChecked ->
                if (isChecked) {
                    listener.showZDHW()
                } else {
                    listener.closeZDHW()
                }
            }
            switch4.setOnCheckedChangeListener { buttonView, isChecked ->
                if (isChecked) {
                    listener.showZhuanWan()
                } else {
                    listener.showZhiXian()
                }
            }
            button1.setOnClickListener {
                listener.showRWD()
            }
            button2.setOnClickListener {
                listener.showGZ()
            }
        }
    }

}